
import request from '@/utils/request'
import { otherFiltersItem } from '@/utils'

/**
 * 编辑进度保存
 * @param {Object} data
 * @returns
 */
export function saveEdit(data) {
  return request({
    url: `/api/v1/decorationDelegateDetail/changeNegotiationProgress`,
    method: 'post',
    data
  })
}

/**
 * 获取洽谈记录
 * @param {string} decorationDelegateDetailId
 * @returns
 */
export function getLog(decorationDelegateDetailId) {
  const data = new FormData()
  data.append('filtersRaw', JSON.stringify([
    otherFiltersItem('decorationDelegateDetailId', decorationDelegateDetailId, '=')
  ]))
  data.append('pageFlag', false)
  return request({
    url: `/api/v1/decorationDelegateNegotiationRecord/page`,
    method: 'post',
    data
  })
}

/**
 * 根据decorationDelegateDetailId查询分页数据
 * @param {string} decorationDelegateDetailId
 * @returns
 */
export function queryPage(decorationDelegateDetailId) {
  const data = new FormData()
  data.append('filtersRaw', JSON.stringify([
    otherFiltersItem('decorationDelegateDetailId', decorationDelegateDetailId, '=')
  ]))
  data.append('pageFlag', false)
  return request({
    url: `/api/v1/decorationDelegateDetail/negotiationTaskPage`,
    method: 'post',
    data
  })
}
/**
 * 查询日志
 * @param {*} sourceId
 * @returns
 */
export function getRecords(sourceId) {
  const data = new FormData()
  data.append('pageFlag', false)
  data.append('sort', 'createTime')
  data.append('order', 'desc')
  data.append('filtersRaw', JSON.stringify([otherFiltersItem('sourceId', sourceId, '='), otherFiltersItem('operateModel', '18', '=')]))
  return request({
    url: '/api/v1/log/page',
    method: 'POST',
    data
  })
}
